#!usr/bin/python
# -*- coding: UTF-8 -*-
import random as r

class Fish:
    def __init__(self):
        self.x = r.randint(0, 10)
        self.y = r.randint(0, 10)

    def move(self):
        self.x -= 1
        print('我的位置是：', self.x, self.y)

class Goldfish(Fish):
    pass  #占位符，啥都不干，光继承Fish

class Garp(Fish):
    pass  #占位符，啥都不干，光继承Fish

class Salmon(Fish):
    pass  #占位符，啥都不干，光继承Fish

class Shark(Fish):
    def __init__(self):
        #shark.move()
        #报错，__init__重写了，覆盖了父类
        #Fish.__init__(self)
        print('super')
        super().__init__()
        self.hungry = True

    def eat(self):
        if self.hungry:
            print('吃货的梦想就是天天有的吃(#^.^#)')
            self.hungry = False
        else:
            print('太撑了，吃不下了!')

fish = Fish()
fish.move()
fish.move()

goldFish = Goldfish()
goldFish.move()
goldFish.move()

shark = Shark()
shark.eat()
shark.eat()

shark.move()  #重写，__init__重写了，覆盖了父类

Fish.__init__(shark)
shark.move()



#多重继承
class Base1:
    def foo1(self):
        print('我是foo1，我为base1带盐...')

class Base2:
    def foo2(self):
        print('我是foo2， 我为base2带盐...')

class C(Base1, Base2):
    pass  #占位符，啥都不干，光继承Fish
c = C()
c.foo1()  #多继承，继承多种属性和方法,多继承很容易出现不可预见的bug
c.foo2()




